﻿using System;
using System.Collections.Generic;
using Microsoft.SharePoint.Administration;

namespace Com.FastSearch.SharePoint.BL.SearchManager.Admin
{
    /// <summary>
    /// An extensible store for data related to ESP connections.
    /// </summary>
    public class ESPConnectionData : SPPersistedObject
    {
        /// <summary>
        /// The key under which the connection data is stored in SharaPoint.
        /// </summary>
        public const string ESP_CONNECTION_DATA = "ESPConnectionData";

        /// <summary>
        /// A dictionary for storing data.
        /// </summary>
        [Persisted]
        public Dictionary<string, string> Entries;

        /// <summary>
        /// Default constructor. Required to retrieve the persisted object
        /// using SPWebApplication.GetChild.
        /// </summary>
        public ESPConnectionData()
        {
        }

        /// <summary>
        /// Constructor for the initial bootstrap of the store, if it can't
        /// be retrieved using SPWebApplication.GetChild.
        /// </summary>
        /// <param name="Parent">the parent object, typically an SPWebApplication</param>
        /// <param name="Id">a unique identifier</param>
        public ESPConnectionData(SPPersistedObject Parent, Guid Id)
            : base(ESP_CONNECTION_DATA, Parent, Id)
        {
        }
    }
}